<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>局部注册</title>
    <!-- Delete ".min" for console warnings in development -->
    <script src="../vue.js"></script>

  </head>
  <body>

    <!-- app -->
    <div id="app">
      组件注册 — Vue.js<br />
      https://cn.vuejs.org/v2/guide/components-registration.html<br />
      <br />
      非 Prop 的 Attribute</br >
      data-date-picker="activated"
      <br />
      <custom-input data-date-picker="activated"
        v-model="searchText"
      ></custom-input>
      <div>{{searchText}}</div>
    </div>

    <script>

// 定义一个新组件
var CustomInput = {
  // inheritAttrs: false,
  props:['value'],
  template: `
    <div class="demo-custom-input">
      <input 
        :value="value"
        v-on:input="$emit('input' , $event.target.value)"
      >
    </div>
    `
};

var app = new Vue({
  el: '#app',
  data : {
    searchText : ''
  },
  components:{CustomInput},
  created: function () {
    // `this` 指向 vm 实例
    var fileName = 'uni-tabs1/uni-tabs2.nvue';
    var a = fileName
        .split('/')
        .pop()
        .replace(/\.\w+$/, '')
    console.log(a)
  }
})


    </script>
  </body>
</html>
